/* 通用页面样式 */
body {
    background: #f5f7fa;
}

ons-page {
    background: #f5f7fa;
}

/* 工具栏美化 - 添加硬件加速优化 */
ons-toolbar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    /* 添加硬件加速 */
    transform: translateZ(0);
    will-change: transform;
    transition: box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

ons-toolbar .center {
    color: white;
    font-weight: 600;
}

ons-back-button {
    color: white;
}

/* 内容区域 */
.content-wrapper {
    padding: 20px;
}

/* 标题样式 */
.section-title {
    font-size: 20px;
    font-weight: 600;
    color: #2c3e50;
    margin: 30px 0 15px 0;
    padding-left: 12px;
    border-left: 4px solid #667eea;
}

.section-title:first-child {
    margin-top: 0;
}

.section-description {
    color: #7f8c8d;
    line-height: 1.8;
    margin-bottom: 30px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* 卡片美化 */
ons-card {
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    border: none;
    margin: 15px 0;
    overflow: hidden;
    /* 添加动画效果 */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateZ(0);
    will-change: transform, box-shadow;
}

ons-card:hover {
    transform: translateY(-2px) translateZ(0);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

ons-card .title {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    padding: 16px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

ons-card .content {
    padding: 16px;
    color: #495057;
    line-height: 1.6;
}

/* 按钮美化 - 添加硬件加速优化 */
ons-button {
    border-radius: 8px;
    font-weight: 500;
    text-transform: none;
    padding: 10px 20px;
    /* 优化过渡效果 */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    /* 启用硬件加速 */
    transform: translateZ(0);
    will-change: transform, box-shadow;
}

ons-button:active {
    transform: scale(0.98) translateZ(0);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

ons-button:hover {
    transform: translateY(-1px) translateZ(0);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* 涟漪动画效果 */
@keyframes ripple-animation {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 0;
    }
}

/* 列表美化 - 添加硬件加速优化 */
ons-list {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    margin: 15px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    /* 添加硬件加速 */
    transform: translateZ(0);
}

ons-list-item {
    /* 优化点击动画 */
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateZ(0);
    will-change: transform, background-color;
}

ons-list-item:hover {
    background-color: rgba(102, 126, 234, 0.08);
    transform: translateX(2px) translateZ(0);
}

ons-list-item:active {
    background-color: rgba(102, 126, 234, 0.15);
    transform: scale(0.98) translateZ(0);
}

ons-list-header {
    background: #f8f9fa;
    color: #495057;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 16px;
}

ons-list-item {
    border-bottom: 1px solid #f0f0f0;
    padding: 14px 16px;
}

ons-list-item:last-child {
    border-bottom: none;
}

/* 输入框美化 */
ons-input, .text-input, .textarea {
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    padding: 12px;
    font-size: 15px;
    transition: border-color 0.3s;
}

ons-input:focus, .text-input:focus, .textarea:focus {
    border-color: #667eea;
    outline: none;
}

/* 进度条美化 */
ons-progress-bar {
    border-radius: 10px;
    overflow: hidden;
}

/* 分段控件美化 */
ons-segment {
    border-radius: 8px;
    overflow: hidden;
    background: #f0f0f0;
    padding: 4px;
}

ons-segment button {
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.3s;
}

ons-segment button.active {
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* 提示框样式 */
.info-box {
    padding: 16px;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-radius: 12px;
    border-left: 4px solid #2196f3;
    margin: 15px 0;
}

.info-box-icon {
    color: #2196f3;
    font-size: 24px;
    margin-right: 12px;
}

.info-box-title {
    font-weight: 600;
    color: #1976d2;
    margin-bottom: 8px;
    font-size: 16px;
}

.info-box-content {
    color: #0d47a1;
    line-height: 1.6;
    font-size: 14px;
}

/* 警告框样式 */
.warning-box {
    padding: 16px;
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border-radius: 12px;
    border-left: 4px solid #ff9800;
    margin: 15px 0;
}

.warning-box-icon {
    color: #ff9800;
}

/* 成功框样式 */
.success-box {
    padding: 16px;
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border-radius: 12px;
    border-left: 4px solid #4caf50;
    margin: 15px 0;
}

/* 渐变背景图标 */
.gradient-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.gradient-icon-wrapper ons-icon {
    color: white;
    font-size: 24px;
}

/* 示例容器 */
.example-container {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin: 15px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* 间距工具类 */
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mt-30 { margin-top: 30px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.mb-30 { margin-bottom: 30px; }
.p-10 { padding: 10px; }
.p-20 { padding: 20px; }

/* 文本工具类 */
.text-center { text-align: center; }
.text-muted { color: #7f8c8d; }
.text-primary { color: #667eea; }
.text-success { color: #4caf50; }
.text-warning { color: #ff9800; }
.text-danger { color: #f44336; }

/* 单选框样式修复 */
ons-radio {
    display: inline-block;
    vertical-align: middle;
}

/* 确保单选框内部的input和圆圈显示 */
ons-radio input[type="radio"] {
    position: relative;
    width: 20px;
    height: 20px;
    margin: 0;
    cursor: pointer;
    opacity: 1 !important;
    z-index: 1;
}

/* 添加自定义单选框样式 */
ons-radio input[type="radio"]::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 20px;
    height: 20px;
    border: 2px solid #667eea;
    border-radius: 50%;
    background: white;
    box-sizing: border-box;
}

ons-radio input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    top: 5px;
    left: 5px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #667eea;
}

/* 选择器样式修复 */
select.select-input {
    width: 100% !important;
    height: 45px !important;
    padding: 10px 36px 10px 12px !important;
    border: 2px solid #ddd !important;
    border-radius: 6px !important;
    font-size: 15px !important;
    background-color: white !important;
    color: #333 !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    background-image: url('data:image/svg+xml;charset=UTF-8,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2212%22 height=%228%22 viewBox=%220 0 12 8%22%3E%3Cpath fill=%22%23667eea%22 d=%22M0 0l6 8 6-8z%22/%3E%3C/svg%3E') !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    cursor: pointer !important;
    line-height: normal !important;
    vertical-align: middle !important;
    box-sizing: border-box !important;
}

select.select-input:focus {
    outline: none !important;
    border-color: #667eea !important;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1) !important;
}

/* 确保选中的选项正常显示 */
select.select-input option {
    padding: 10px;
    background-color: white;
    color: #333 !important;
    font-size: 15px;
}

select.select-input option:checked {
    background-color: #667eea;
    color: white !important;
}

/* 默认选项样式 */
select.select-input option[disabled] {
    color: #999 !important;
}

/* ==================== 代码展示组件样式 ==================== */
.code-example-section {
    margin-top: 30px;
    margin-bottom: 30px;
}

.code-example-container {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 20px;
}

.code-demo-area {
    padding: 24px;
    border-bottom: 1px solid #e8e8e8;
    background: #fafafa;
}

.code-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: white;
    border-bottom: 1px solid #e8e8e8;
    cursor: pointer;
    user-select: none;
}

.code-actions:hover {
    background: #fafafa;
}

.code-actions-left {
    display: flex;
    align-items: center;
    font-size: 14px;
    color: #666;
}

.code-actions-left ons-icon {
    margin-right: 8px;
    font-size: 18px;
}

.code-actions-right {
    display: flex;
    gap: 8px;
}

.code-action-btn {
    padding: 4px 12px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    background: white;
    color: #666;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.3s;
}

.code-action-btn:hover {
    color: #667eea;
    border-color: #667eea;
}

.code-action-btn ons-icon {
    font-size: 16px;
}

.code-action-btn.copied {
    color: #52c41a;
    border-color: #52c41a;
}

.code-display {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: #282c34;
}

.code-display.expanded {
    max-height: 800px;
    overflow-y: auto;
}

.code-display pre {
    margin: 0;
    padding: 16px;
    overflow-x: auto;
}

.code-display code {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: #abb2bf;
    display: block;
    white-space: pre;
}

/* 简单的代码高亮 */
.code-tag {
    color: #e06c75;
}

.code-attr {
    color: #d19a66;
}

.code-value {
    color: #98c379;
}

.code-comment {
    color: #5c6370;
    font-style: italic;
}

.code-keyword {
    color: #c678dd;
}

.code-function {
    color: #61afef;
}

.code-string {
    color: #98c379;
}

/* 示例标题 */
.example-title {
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
}

.example-title ons-icon {
    margin-right: 8px;
    color: #667eea;
}

/* 响应式间距 */
@media (max-width: 768px) {
    .content-wrapper {
        padding: 15px;
    }
    
    .section-title {
        font-size: 18px;
    }
}

/* ===== 性能优化样式 ===== */

/* 页面切换动画优化 */
ons-page {
    transform: translateZ(0);
    will-change: transform, opacity;
}

/* 图标动画优化 */
ons-icon {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateZ(0);
}

ons-icon:hover {
    transform: scale(1.1) translateZ(0);
}

/* 输入框优化 */
ons-input {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateZ(0);
}

ons-input:focus {
    transform: translateZ(0);
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

/* 浮动按钮优化 */
ons-fab {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateZ(0);
    will-change: transform, box-shadow;
}

ons-fab:hover {
    transform: scale(1.1) translateZ(0);
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

ons-fab:active {
    transform: scale(0.95) translateZ(0);
}

/* 标签栏优化 */
ons-tabbar {
    transform: translateZ(0);
    will-change: transform;
}

ons-tab {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateZ(0);
}

ons-tab:active {
    transform: scale(0.98) translateZ(0);
}

/* 轮播组件优化 */
ons-carousel {
    transform: translateZ(0);
    will-change: transform;
}

ons-carousel-item {
    transform: translateZ(0);
    will-change: transform;
}

/* 进度条优化 */
ons-progress-bar {
    transform: translateZ(0);
    will-change: transform;
}

ons-progress-circular {
    transform: translateZ(0);
    will-change: transform;
}

/* 分段控件优化 */
ons-segment {
    transform: translateZ(0);
    will-change: transform;
}

/* 通用硬件加速类 */
.hw-accelerated {
    transform: translateZ(0);
    will-change: transform;
}

.smooth-transition {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 性能优化工具类 */
.no-select {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.gpu-layer {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}
